#include "qbciconfig.h"
#include <QFile>
#include <QLogger>

using namespace bci;
QBciConfig::QBciConfig(QObject *parent) : QObject(parent) {}

bool QBciConfig::loadFromFile(const QString &filename) {
  QFile file(filename);
  if (!file.open(QIODevice::ReadOnly)) {
    QLogger::Error("file.open ReadOnly fail");
    return false;
  }
  //从json文件读取信息
  QByteArray allData = file.readAll();
  file.close();
  root.Parse(allData);

  if (root.HasParseError()) {
    QLogger::Error("Json parse fail ");
    return false;
  }
  return true;
}
